package com.sscaipiao.android.activity.ThreeD;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.sscaipiao.android.R;
import com.sscaipiao.android.activity.Base.RedBallGroupTenActivity;
import com.sscaipiao.android.activity.Base.RedBallSingleArrayActivity;
import com.sscaipiao.android.activity.DaLeTou.DaLeTouHistoryActivity;
import com.sscaipiao.android.activity.DaLeTou.DaLeTouPayActivity;
import com.sscaipiao.android.activity.PaiLieSan.PaiLieSanHistoryActivity;
import com.sscaipiao.android.activity.PaiLieSan.PaiLieSanPayActivity;
import com.sscaipiao.android.common.Constants;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Airay.Rong on 14-1-2.
 */
public class SanDZhiXuanActivity extends RedBallGroupTenActivity {
	private final static int MAX_BALL_NUM = 30;
	private final static int MIN_CHOOSE_NUM = 3;
	private final static int MAX_BALL_GROUP = 3;
	private final static Class ACTIVITY_HIS = SanDZhiXuanHistoryActivity.class;
	private final static Class ACTIVITY_PAY = SanDZhiXuanPayActivity.class;


	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		addContainerMain(R.layout.red_ball_group_ten_activity);
		setupUI(true, false, true, true, true);
		setTitleText("3D");
		setInfo("红球区 至少选择3个红球");
		addRedBallGroup(MAX_BALL_GROUP);
		setGroupLabel("百位", "十位", "个位");
		setRadomBallNum(MIN_CHOOSE_NUM);
		reCalculatorSum();
		LOTT_CODE = Constants.getLottCodeByClass(SanDZhiXuanActivity.class);
		setupHeadBar(LOTT_CODE);
		setupLottLostValues();

	}

	@Override
	public void onResume() {
		super.onResume();

//		showProgressDialog();
//		setLottInformation(getIntent(),LOTT_CODE);
//		if (getLottLostValues()) {
//			setupLostValues();
//		}
//		reCalculatorSum();
//		closeProgressDailog();
	}

	public void onClick(View v) {
		super.onClick(v);
		if (R.id.btn_confirm == v.getId()) {
			doConfirm();
		}
		if (R.id.btn_show_history == v.getId()) {
			showLottHistory(ACTIVITY_HIS);
		}
	}
	private void doConfirm() {
		List<Integer> redChooseBalls = queryChoseRedBallArray();
		if (!checkChoseBallRulls(redChooseBalls)) {
			String text = "请每组至少选1个红球";
			Toast.makeText(this, text, Toast.LENGTH_SHORT).show();
			return;
		}
		checkAndStartPayActivity(ACTIVITY_PAY);
	}


}